/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package utn.tsb.tej.world_logic;

import java.io.Serializable;

/**
 *
 * @author Administrador
 */
public class Color implements Comparable, Serializable {

    private String codeRGB;
    public static final String BLUE = "0,0,255";
    public static final String GREEN = "0,255,0";
    public static final String RED = "255,0,0";
    public static final String WHITE = "255,255,255";
    public static final String BLACK = "0,0,0";
    public static final String YELLOW = "255,255,0";

    public Color(String codeRGB) {
        this.codeRGB = codeRGB;
    }

    public Color() {
        this(Color.BLACK);
    }

    public String getCodeRGB() {
        return codeRGB;
    }

    public void setCodeRGB(String codeRGB) {
        this.codeRGB = codeRGB;
    }

    @Override
    public int compareTo(Object o) {
        if (!(o instanceof Color)) {
            return -1;
        }

        Color colorToCompare = (Color) o;

        return getCodeRGB().compareToIgnoreCase(colorToCompare.getCodeRGB());

    }

    public String toString() {
        String colorName="Agun color raro";

        if(codeRGB.compareToIgnoreCase(RED)==0){
            colorName="Rojo";
        }
          if(codeRGB.compareToIgnoreCase(BLACK)==0){
            colorName="Negro";
        }
          if(codeRGB.compareToIgnoreCase(GREEN)==0){
            colorName="Verde";
        }
          if(codeRGB.compareToIgnoreCase(BLUE)==0){
            colorName="Azul";
        }
          if(codeRGB.compareToIgnoreCase(WHITE)==0){
            colorName="Banco";
        }
          if(codeRGB.compareToIgnoreCase(YELLOW)==0){
            colorName="Amarillo";
        }


        return colorName;

    }
}
